package pa2;


import java.util.Arrays;
import java.util.Comparator;


public class Test {

    public static void my_sort(Comparable[] comparable){
        for (int i = 0; i < comparable.length - 1; i++) {
            for (int j = 0; j < comparable.length - 1 - i; j++) {
                if (comparable[j].compareTo(comparable[j+1]) > 0){
                    Comparable tmp = comparable[j];
                    comparable[j] = comparable[j+1];
                    comparable[j+1] = tmp;
                }
            }
        }
    }

    public static void main(String[] args){


        Student student1 = new Student(12,"zahngsan");

        Student student2 = new Student(15,"lisi");

        NameComparator nameComparator = new NameComparator();
        System.out.println(nameComparator.compare(student1, student2));
        AgeComparator ageComparator = new AgeComparator();
        System.out.println(ageComparator.compare(student1, student2));




        /*Student[] students = new Student[3];
        students[0] = new Student(18,"小明");
        students[1] = new Student(15,"小礼");
        students[2] = new Student(21,"小花");
*/


/*
               my_sort(students);
        System.out.println(Arrays.toString(students));
*/




        /*Student student1 = new Student(12,"小明");
        Student student2 = new Student(15,"小美");

        System.out.println(student1.compareTo(student2));
        System.out.println(student2.compareTo(student1));*/
    }

}
